﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Poke_Tactics.Main_Game
{
    class Main_Game
    {

        GameWindow Window;
        Texture2D background;

        public Vector2 mousePos;

        public Camera camera { get { return Game1.cameraAtual; } set { Game1.cameraAtual = value; } }

        public Main_Map worldMap;

        public Object player;

        #region cities
        public enum places
        {
            worldMap,
            Pallet,
            Viridian,
        }
        places currentCity = places.worldMap;
        City.Pallet Pallet;
        Vector2 testPos = new Vector2();
        #endregion

        

        public Main_Game(GameWindow Window, ContentManager Content, GraphicsDevice graphics)
        {
            this.Window = Window;
            this.camera = new Camera(graphics);
            this.camera.position = new Vector2(336, 800);
            this.worldMap = new Main_Map(Window, Content);
            this.Pallet = new City.Pallet(Window, Content);
            

        }

        public void Update(GameTime gameTime, MouseState mouse, MouseState old_mouse, KeyboardState keyboard, KeyboardState old_keyboard)
        {
            #region Atualização de Inputs convertidos pra camera
            mousePos = Vector2.Transform(new Vector2(mouse.X, mouse.Y), Matrix.Invert(camera.transformMatrix));
            #endregion


         

            switch (currentCity)
            {
                case places.worldMap:
                    {
                        worldMap.Update(gameTime, mousePos, mouse, old_mouse, keyboard);
                        break;
                    }
                case places.Pallet:
                    {
                        Pallet.Update(gameTime, mouse, old_mouse);
                        break;
                    }
            }

        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            

            switch (currentCity)
            {
                case places.worldMap:
                    {
                        worldMap.Draw(gameTime, spriteBatch);
                        break;
                    }
                case places.Pallet:
                    {
                        Pallet.Draw(gameTime, spriteBatch);
                        break;
                    }
            }

        }




    }
}
